From: Keir Fraser Date: Fri, 12 Feb 2010 09:21:57 +0000 (+0000) Subject: keyhandler: Do not serialise keyhandlers; increase scratch array size. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~12606 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=d652a9595460cfc81afeb66c17aef7adedfb9175;p=xen.git keyhandler: Do not serialise keyhandlers; increase scratch array size. Although serialising keyhandlers is safer, and in particular protects access to shared heyhandler_scratch[], in debug scenarios it is probably better to 'have a go' when requested - and assume the user knows what they are doing. Meanwhile, increase scratch array size to 1024. That's enough for more than a dozen lines of 80-column text, and should be plenty in any practical situation. Signed-off-by: Keir Fraser --- diff --git a/xen/common/keyhandler.c b/xen/common/keyhandler.c index 78daf45a3d..e3e64a1953 100644 --- a/xen/common/keyhandler.c +++ b/xen/common/keyhandler.c @@ -20,7 +20,7 @@ static struct keyhandler *key_table[256]; static unsigned char keypress_key; -char keyhandler_scratch[100]; +char keyhandler_scratch[1024]; static void keypress_action(unsigned long unused) { @@ -31,7 +31,6 @@ static DECLARE_TASKLET(keypress_tasklet, keypress_action, 0); void handle_keypress(unsigned char key, struct cpu_user_regs *regs) { - static bool_t executing_handler; struct keyhandler *h; if ( (h = key_table[key]) == NULL ) @@ -39,18 +38,9 @@ void handle_keypress(unsigned char key, struct cpu_user_regs *regs) if ( !in_irq() || h->irq_callback ) { - /* - * No concurrent handler execution: prevents garbled console and - * protects keyhandler_scratch[]. - */ - if ( test_and_set_bool(executing_handler) ) - return; - wmb(); console_start_log_everything(); h->irq_callback ? (*h->u.irq_fn)(key, regs) : (*h->u.fn)(key); console_end_log_everything(); - wmb(); - executing_handler = 0; } else { diff --git a/xen/include/xen/keyhandler.h b/xen/include/xen/keyhandler.h index 1670d7d7f9..d3ab0a90fd 100644 --- a/xen/include/xen/keyhandler.h +++ b/xen/include/xen/keyhandler.h @@ -53,6 +53,6 @@ extern void register_keyhandler(unsigned char key, struct keyhandler *handler); extern void handle_keypress(unsigned char key, struct cpu_user_regs *regs); /* Scratch space is available for use of any keyhandler. */ -extern char keyhandler_scratch[100]; +extern char keyhandler_scratch[1024]; #endif /* __XEN_KEYHANDLER_H__ */